<?php
/**
 +------------------------------------------------------------------------------
 * NewsAction控制器类
 +------------------------------------------------------------------------------
 * @category   view
 * @package  index
 * @subpackage  index
 * @author   朝闻道 <hydata@gmail.com>
 * @date 2010-8-31
 * @time  上午09:58:09
 +------------------------------------------------------------------------------
 */
class NewsAction extends CommonAction{
	protected $dao;
	
	/**
	   *新闻页面初始化
	   *@date 2010-12-8 / @time 下午04:48:06
	   */
	function _initialize() {
		//新闻页面初始化
		parent::_initialize();
		$this->dao=D("News");
	}//end _initialize()
	/**
	   *新闻页面频道封面
	   *@date 2010-8-31
	   *@time 上午09:58:16
	   */
	function index() {
		//新闻页面频道封面
		$list=array();
		$condition=array();
		$limit="";
		$order="ntime DESC";
		$count=$this->dao->where($condition)->count();
		$page=new Page($count, 25);
		$page->config=array('header'=>'Rows','prev'=>'Previous','next'=>'Next','first'=>'«','last'=>'»','theme'=>' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
		$this->assign('showpage',$page->show());
		$limit=$page->firstRow.','.$page->listRows;
		$list=$this->dao->where($condition)->order($order)->limit($limit)->findAll();
		$this->assign("list",$list);
		unset($page,$list);
		$this->display();
	}//end index
	
	/**
	   *新闻详情
	   *@date 2010-12-8 / @time 下午04:45:51
	   */
	function detail() {
		//新闻详情
		$id=Input::getVar($_GET['id']);
		$condition=array("id"=>$id);
		$info=$this->dao->where($condition)->find();
		$this->assign("info",$info);
		$this->display();
	}//end detail
}//end NewsAction